import request from '@/utils/request'

//添加项目
export const addNewWork = data => {
  return request({
    url:'oa/project/addProject',
    method:'post',
    data,
  })
}

//查找立项数据
export const getProjectLx = query => {
  return request({
    url:'oa/project/getProjectLx',
    method:'get',
    params: query,
  })
}

//立项详情
export const getProjectLxDetail = query => {
  return request({
    url:'oa/project/projectDetail',
    method:'get',
    params: query,
  })
}

//比较数据差异
export const addShenPiLog = data => {
  return request({
    url:'oa/log/add',
    method:'post',
    data
  })
}

//修改立项数据
export const editProjectLx = data => {
  return request({
    url:`oa/project/editProjectLx/${data.id}`,
    method:'post',
    data
  })
}

//修改流程审批
export const editProjectState = data => {
  return request({
    url:'oa/editProjectState',
    method:'post',
    data
  })
}


//修改合作商
export const editProjectPartnerID = data => {
  return request({
    url:'oa/project/editProjectPartner',
    method:'post',
    data
  })
}

//预算数据提交
export const getYsList = query => {
  return request({
    url: '/oa/project/getYsList',
    method: 'get',
    params: query,
  })
}

//项目基本信息
export const getProjectBase = query => {
  return request({
    url: '/oa/project/projectBase',
    method: 'get',
    params: query,
  })
}

//添加预算数据
export const addProjectYs = data =>{
  return request({
    url:'oa/project/addProjectYs',
    method:'post',
    data
  })
}

//预算列表数据
export const getProjectYsData = query => {
  return request({
    url: '/oa/project/getProjectYsList',
    method: 'get',
    params: query,
  })
}

//获取预算详情
export const getYsDtail = query => {
  return request({
    url: `/oa/project/getProjectYsDetail/${query.id}`,
    method: 'get',
    params: query,
  })
}

//编辑预算数据
export const editProjectYs = data =>{
  return request({
    url:`oa/project/editProjectYs/${data.id}`,
    method:'post',
    data
  })
}

//更新销售经理
export const updateSeller = data => {
  return request({
    url:`oa/project/updateSeller/${data.id}`,
    method:'post',
    data
  })
}

//获取结算下拉
export const getProjectJsSelect = query => {
  return request({
    url: '/oa/project/getProjectJsSelect',
    method: 'get',
    params: query,
  })
}

//获取结算数据
export const getProjectJsData = query => {
  return request({
    url: '/oa/project/getProjectJsData',
    method: 'get',
    params: query,
  })
}

//保存结算数据
export const saveProjectJs = data => {
  return request({
    url:'oa/project/saveProjectData',
    method:'post',
    data
  })
}

//获取结算详情
export const getJsDetail = query => {
  return request({
    url:`oa/project/getJsDetail/${query.id}`,
    method:'get',
    params:query
  })
}

//更新结算数据
export const editProjectJs = data => {
  return request({
    url:`oa/project/editProjectJs/${data.id}`,
    method:'post',
    data
  })
}


//获取待审批的个数
export const getWaitCount = query =>{
  return request({
    url:'/oa/getWaitProject',
    method:'get',
    params:query
  })
}

//删除项目
export const delProject = query => {
  return request({
    url:'/oa/project/delProject',
    method:'get',
    params:query
  })
}

//获取预算数据
export const getYsData = query => {
  return request({
    url:'/oa/project/getYsData',
    method:'get',
    params:query
  })
}

//获取汇总数据
export const getSummaryData = query =>{
  return request({
    url:'/oa/summary/getList',
    method:'get',
    params:query
  })
}

//获取汇总详情
export const getSummaryDetail = query => {
  return request({
    url:'/oa/summary/detail',
    method:'get',
    params:query
  })
}


//获取汇总详情
export const calculateProfitApi = data => {
  return request({
    url:'/oa/project/calculate/profit',
    method:'post',
    data
  })
}

//删除预算详情
export const delYsDetailApi = data => {
  return request({
    url:`/oa/project/ys/detail/del/${data.id}`,
    method:'post',
    data
  })
}

//修改预算
export const reCalculateYsProfit = data => {
  return request({
    url:`/oa/project/ys/money/${data.id}`,
    method:'post',
    data
  })
}

